<?php
/**
 * 钻石投票模块-投票列表
 *
 * @author 天涯织梦
 * @url http://bbs.we7.cc/
 */

defined('IN_IA') or exit('Access Denied');
global $_GPC, $_W;
$this->authorization();
$uniacid=$_W['uniacid'];
if($_W['ispost']){
    $id = intval($_GPC['uid']);
    $userInfo = pdo_get($this->tableuser,array('uniacid'=>$uniacid,'id'=>$id),'*');
    if(!$userInfo){
        iajax(-1, '用户不存在或是已经被删除', '');
    }elseif($userInfo['is_leader'] == 1){
        iajax(-1, '该用户已经是管理员', '');
    }else{
        if(pdo_update($this->tableuser,array('is_leader'=>1),array('id'=>$id))){
            iajax(1,'设置成功');
        }else{
            iajax(-1,'设置失败');
        }
    }
}
$list = pdo_fetchall("SELECT * FROM ".tablename($this->tableuser)." WHERE uniacid = $uniacid");
if (!empty($list)) {

}

include $this->template('add_leader');